# MxHero API client A ruby client to interact with the MxHero API ## Instalation gem install mxhero-api or in your Gemfile: gem 'mxhero-api' ## Example of uses Some examples, **complete documentation in the [API client documentation](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html)** ### Instanciate a client client = MxHero::API::Client.new(username: 'api username', password: 'api password', api_url: 'http://api-url-example.mxhero.com/api') [See more](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html#initialize-instance_method) ### Retrieve all the domains # Retrieve all the domains domains = client.domains # Return a hash, example: # # { :elements => [ # { :domain=>"tesla.com", :server=>"tesla.com", :creationDate=>1369837819000, :updatedDate=>1369837819000, :aliases=>nil, :ldap=>nil } # ], # :totalElements=>1, # :totalPages=>1, # :actualPage=>1 # } [See more](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html#domains-instance_method) ### Retrieve all rules for one domain rules = client.rules_for_domain('tesla.com') [See more](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html#rule_for_domain-instance_method) ### Create a rule for one domain # The representation of a rule is a Hash. # Example: rule = { domain: 'test.com', twoWays: false, enabled: true, name: 'Rule name', created: DateTime.now.strftime('%Q'), # epoch time for now fromDirection: { directionType: 'domain', domain: 'test.com', freeValue: 'test.com' }, toDirection: { directionType: 'domain', domain: 'test.com', freeValue: 'test.com' }, properties: [ { propertyKey: 'return.message', propertyValue: 'footer content' } ], component: 'org.mxhero.feature.disclaimer' } # Create a rule for one domain client.create_rule_for_domain('test.com', rule) [See more](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html#create_rule_for_domain-instance_method) ### Update a rule client.update_rule(rule) [See more](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html#update_rule-instance_method) ### find a rule for one domain client.domain_rule('tesla.com', 12) [See more](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html#domain_rule-instance_method) ## Complete documentation Complete documentation in the [API client documentation](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html) ## Run test Run all test rake test Run specific method ruby test/test_emailsync.rb --name=test_delete -v Or: rake test TEST=test/test_foobar.rb TESTOPTS="--name=test_foobar1 -v" ## Build a new version rake version:bump gem build mxhero-api.gemspec gem push mxhero-api-{{ version }}.gem