accounts_client 0.2.31 → 0.2.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/padma_account.rb +21 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0fc27fd38df0dfbcf2cd6c18e2b4a8f4bbaabbf9
4
- data.tar.gz: e19542b73f211061204750c22b48db633d723922
3
+ metadata.gz: 70cc60e87f3219ae65b487a3288238b94b0b4a76
4
+ data.tar.gz: eda096f0442b8055e41dc5aeee648db581ff41b7
5
5
  SHA512:
6
- metadata.gz: 3e9d3667e388f48fdd78d5267a3a0b50193f2578b284ce98bd5ddcc9f1c79f73d5310bd67546f94d16f9b4f4b5189c37165a682f9664b14e7007507ad42470ed
7
- data.tar.gz: 8fa85e3983755e5a883ff60c0bfd213ed3ddd38bdc08458f34fa0787bf776eb77ce3e2dd94a3d8bbc42540f82bb18237e8a69e039b3da9daa1409d5252f74315
6
+ metadata.gz: 23d807b21aa548c681e2c00cf993b9f0da1d435762a6f1664e88f144dc9af855ec715940ad712e4a18ea83f92ca4c176ba8843cc32199c8c0ca2eda694162287
7
+ data.tar.gz: aeeea75569120454eabf1fe32d3fff7d42b650d92d4b21bfa20c8da737c0e63f6ba8b4953787d48f49bb1b69ab9a3c16d062bc56188f05ff7bdc6a19c3eb40d7
@@ -6,6 +6,7 @@ class PadmaAccount < LogicalModel
6
6
  set_resource_path "/v0/accounts"
7
7
 
8
8
  attribute :name
9
+ attribute :vanity_name
9
10
  attribute :enabled
10
11
  attribute :timezone
11
12
  attribute :locale
@@ -73,6 +74,26 @@ class PadmaAccount < LogicalModel
73
74
  res
74
75
  end
75
76
 
77
+ def self.find_by_vanity_name(vanity_name, params={})
78
+ res = nil
79
+ params = self.merge_key(params)
80
+ request = Typhoeus::Request.new("#{resource_uri}/by_vanity_name/#{vanity_name}", params: params )
81
+
82
+ request.on_complete do |response|
83
+ if response.code >= 200 && response.code < 400
84
+ log_ok(response)
85
+ res = self.new.from_json(response.body)
86
+ else
87
+ log_failed(response)
88
+ end
89
+ end
90
+
91
+ self.hydra.queue(request)
92
+ self.hydra.run
93
+
94
+ res
95
+ end
96
+
76
97
  def self.find_with_rails_cache(account_name,options={})
77
98
  pa = Rails.cache.read([account_name,"padma_account"])
78
99
  if pa.nil? || options[:refresh]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: accounts_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.31
4
+ version: 0.2.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dwayne Macgowan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-05 00:00:00.000000000 Z
11
+ date: 2017-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties