mxhero-api 0.1.32 → 0.1.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTg2ZjZkNjM0YjgzMTk4YTE2ZjU5MWI2NDY3ZWQxODlhYzhlN2Y2Ng==
4
+ YjQyMjQzMGIzZWJjY2YxZGQ0ZDQ1OTRhODc4YjA1NmZjMjg0NGU2MQ==
5
5
  data.tar.gz: !binary |-
6
- MTMxYjMwODZlYTFjZTlhNWM2YWQ1NTVjMGViY2QzZDM2ZTBjMTk5ZQ==
6
+ MDQzZWI4ZTQ2ZDAyYjYwYzhjZjZhNTE4YmVmYWNmMDkyZGY5Zjg4ZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTJlOWQ2ZmZmZGY1ZGNkYWJkNjkzODYyNjI1NzM0MTEwN2ExNDQxN2QxNTgw
10
- ZjZlYTQzODE1YmJjZWQ2MzNiOTY2Mjg0MDVlY2NlZTAxYzk0ZTAxYTMxNTUy
11
- NTIwYmZiYjVkOTkwMjI3N2UxODFlZGJmNjMzNjg2MzZlNWJjNjU=
9
+ NTMyY2RkMTNkNzI5MzMyMDY1MDgyYjBhMTMyMWUxMzA4NWVkZjEyYzJhZmNj
10
+ N2QzNjc1MjBmY2ZiMDIyY2QxYzQ2YWM4YTg2Y2FiM2VlYzJjNjMyZDQ2MDlm
11
+ NGM3NTUxNjA0YTdkNTRhMDIyNzA3NmY0ZjQ3YTA4OGQ5OTczY2E=
12
12
  data.tar.gz: !binary |-
13
- ZWJkZWQxZGI0NWVlZDliZGMzYmQzNzEwOGIzZjFjYzExYjgzMDgwMTE1ZWU1
14
- NWYxMjI2ODNiMjU1NTQ2YmMyZjcyMzE0OWE3OGRkNWE2YmNmNzRhMjlmZDlh
15
- N2RiNjE5NWI5ZjVlMTFiNDFjZDQ3N2I3ZmUyODgzODE0YmY3NDg=
13
+ MWQxNWI1NWU4NjZmZDZiYjFkOTU0Yzk0MDA2MTY2ZTAxZWRkODgwM2UwODBh
14
+ NTEzNmNjMzljY2ViODI5ZjE3MGJlYzRjNDc1Y2FlMmJkN2MxNGZjODRlMDQw
15
+ ZjcyNjNiYTRlODk5YzM2NmNhMWM0MjMyNGNlNDAzMjhiNzA0MWU=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.32
1
+ 0.1.33
@@ -1,13 +1,14 @@
1
1
  module MxHero::API
2
-
2
+
3
3
  class Domain < Resource
4
4
 
5
- attributes :domain, :server, :creation_date, :update_date,
6
- :aliases, :features, :cos, :cos_last_change, :metadata
5
+ attributes :domain, :server,
6
+ :aliases, :features, :cos
7
7
 
8
8
  attribute :creation_date, map: 'creationDate', date: true
9
9
  attribute :update_date, map: 'updateDate', date: true
10
10
  attribute :cos_last_change, map: 'cosLastChange', date: true
11
+ attribute :source
11
12
  attribute :metadata
12
13
 
13
14
  def initialize(data = {})
@@ -19,12 +20,12 @@ module MxHero::API
19
20
 
20
21
  def change_to_trial
21
22
  if cos.type == 'free'
22
- cos.type = 'trial'
23
+ cos.type = 'trial'
23
24
  end
24
25
  end
25
-
26
- private
27
-
26
+
27
+ private
28
+
28
29
  def load_cos(cos)
29
30
  @cos = Cos.new cos
30
31
  end
@@ -50,13 +51,22 @@ module MxHero::API
50
51
  if max_rules_amount == 0 || max_rules_amount.nil?
51
52
  @max_rules_amount = Float::INFINITY
52
53
  end
54
+ load_metadata
53
55
  end
54
56
 
55
57
  def unlimited_use?
56
58
  max_rules_amount == Float::INFINITY
57
59
  end
60
+
61
+ private
62
+
63
+ def load_metadata
64
+ @metadata = JSON.parse(metadata, symbolize_names: true) if metadata
65
+ end
66
+
58
67
  end
59
68
 
69
+
60
70
  class Cos < Resource
61
71
  attribute :type, map: 'cos'
62
72
  attribute :edition
@@ -1,13 +1,13 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: mxhero-api 0.1.32 ruby lib
2
+ # stub: mxhero-api 0.1.33 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "mxhero-api"
6
- s.version = "0.1.32"
6
+ s.version = "0.1.33"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.authors = ["Maximiliano Dello Russo", "Juan Pablo Royo", "mxHero"]
10
- s.date = "2014-04-15"
10
+ s.date = "2014-07-22"
11
11
  s.description = "A gem to provide easy access to the API of MxHero platform (http://www.mxhero.com/)"
12
12
  s.email = ["maxidr@mxhero.com", "juanpablo.royo@gmail.com", "mxhero@mxhero.com"]
13
13
  s.files = [".gitignore", ".ruby-gemset", ".ruby-version", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "VERSION", "lib/communication.rb", "lib/directories.rb", "lib/dto.rb", "lib/groups.rb", "lib/mxhero-api.rb", "lib/resource.rb", "lib/resources/account.rb", "lib/resources/domain.rb", "lib/resources/group.rb", "lib/urls.rb", "mxhero-api.gemspec", "test/fixtures/api/account_properties.yml", "test/fixtures/api/account_properties_not_found.yml", "test/fixtures/api/accounts.yml", "test/fixtures/api/accounts_filtered.yml", "test/fixtures/api/accounts_from_domain.yml", "test/fixtures/api/accounts_from_domain_paginated.yml", "test/fixtures/api/accounts_without_group.yml", "test/fixtures/api/add_an_inexistent_account_to_group.yml", "test/fixtures/api/add_and_remove_account.yml", "test/fixtures/api/all_groups.yml", "test/fixtures/api/create_directory.yml", "test/fixtures/api/create_rule_for_domain.yml", "test/fixtures/api/create_user.yml", "test/fixtures/api/delete_directory.yml", "test/fixtures/api/delete_group.yml", "test/fixtures/api/delete_rule.yml", "test/fixtures/api/domain_by_id.yml", "test/fixtures/api/domain_by_id_not_found.yml", "test/fixtures/api/domain_rule.yml", "test/fixtures/api/domains.yml", "test/fixtures/api/fetch_directory.yml", "test/fixtures/api/fetch_user.yml", "test/fixtures/api/ldap_info.yml", "test/fixtures/api/move_to_trial.yml", "test/fixtures/api/refresh_directory.yml", "test/fixtures/api/remove_account_from_group_twice.yml", "test/fixtures/api/remove_inexistente_account_from_group.yml", "test/fixtures/api/rules_for_domain.yml", "test/fixtures/api/rules_for_domain_by_component.yml", "test/fixtures/api/save_group.yml", "test/fixtures/api/system_properties.yml", "test/fixtures/api/system_properties_create.yml", "test/fixtures/api/system_properties_element.yml", "test/fixtures/api/test_domain.yml", "test/fixtures/api/update_account_properties.yml", "test/fixtures/api/update_accounts_group_scope.yml", "test/fixtures/api/update_accounts_properties_scope.yml", "test/fixtures/api/update_directory.yml", "test/fixtures/api/update_rule.yml", "test/fixtures/api/update_user.yml", "test/fixtures/api/user_domains.yml", "test/fixtures/api/validate_user_credential.yml", "test/fixtures/domain.rb", "test/helper.rb", "test/test_directories.rb", "test/test_domain.rb", "test/test_dto.rb", "test/test_feature.rb", "test/test_groups.rb", "test/test_mxhero_api.rb", "test/test_mxhero_api_response.rb", "test/test_resource.rb"]
@@ -1,7 +1,7 @@
1
1
  module Fixtures
2
2
  module Domain
3
-
4
- def self.data
3
+
4
+ def self.data
5
5
  @data ||= {
6
6
  domain: "mxhero.com",
7
7
  server: "aspmx.l.google.com",
@@ -16,12 +16,13 @@ module Fixtures
16
16
  feature: "org.mxhero.feature.signature",
17
17
  created: 1387296659000,
18
18
  updated: nil,
19
- metadata: nil,
19
+ metadata: '{"appId":719005621603,"serviceAccount":"719005621603-avjqrr8333o7pdsfugtvr9bavbq67d48@developer.gserviceaccount.com","userAdmins":["admin@gapps.mxtrial.com"]}',
20
20
  maxRulesAmount: 2
21
21
  }
22
22
  ],
23
23
  cos: { cos: "trial", edition: nil },
24
- cosLastChange: 1387303649000
24
+ cosLastChange: 1387303649000,
25
+ source: "gapps"
25
26
  }
26
27
  end
27
28
 
@@ -9,6 +9,7 @@ class DomainTest < MiniTest::Unit::TestCase
9
9
  assert_equal DateTime.strptime(data[:cosLastChange].to_s, '%Q'), domain.cos_last_change
10
10
  assert domain.cos.is_a? MxHero::API::Cos
11
11
  assert_equal data[:cos][:cos], domain.cos.type
12
+ assert_equal data[:source], domain.source
12
13
  end
13
14
 
14
15
  def test_change_domain_to_trial
@@ -21,9 +22,8 @@ class DomainTest < MiniTest::Unit::TestCase
21
22
  assert_equal 'post_trial', domain.cos.type
22
23
  end
23
24
 
24
- def data
25
+ def data
25
26
  Fixtures::Domain.data
26
27
  end
27
28
 
28
29
  end
29
-
@@ -5,9 +5,11 @@ class FeatureTest < MiniTest::Unit::TestCase
5
5
  def test_build_feature_domain
6
6
  feature = MxHero::API::Feature.new data
7
7
  assert_equal data[:feature], feature.component
8
- assert_nil feature.updated
8
+ assert_nil feature.updated
9
9
  assert_equal data[:maxRulesAmount], feature.max_rules_amount
10
10
  assert ! feature.unlimited_use?
11
+ assert feature.metadata.is_a? Hash
12
+ assert_equal feature.metadata[:appId], 719005621603
11
13
  end
12
14
 
13
15
  def test_unlimited_use
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mxhero-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.32
4
+ version: 0.1.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maximiliano Dello Russo
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-04-15 00:00:00.000000000 Z
13
+ date: 2014-07-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: vcr