Class: AppStoreDevApi::Request::Builder::Create
- Inherits:
-
Object
- Object
- AppStoreDevApi::Request::Builder::Create
- Defined in:
- lib/app_store_dev_api/request/builder/create.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #alias ⇒ Object
- #http_method ⇒ Object
-
#initialize(type, properties, version = 'v1') ⇒ Create
constructor
A new instance of Create.
- #source ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(type, properties, version = 'v1') ⇒ Create
Returns a new instance of Create.
35 36 37 38 39 40 41 |
# File 'lib/app_store_dev_api/request/builder/create.rb', line 35 def initialize(type, properties, version = 'v1') @name = type.singularize.classify @name = name @type = type @properties = properties @version = version end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
26 27 28 |
# File 'lib/app_store_dev_api/request/builder/create.rb', line 26 def name @name end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
26 27 28 |
# File 'lib/app_store_dev_api/request/builder/create.rb', line 26 def properties @properties end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
26 27 28 |
# File 'lib/app_store_dev_api/request/builder/create.rb', line 26 def type @type end |
Class Method Details
.from(schema) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/app_store_dev_api/request/builder/create.rb', line 28 def self.from(schema) type = schema.properties['data']['properties']['type']['enum'][0] properties = schema.properties['data']['properties']['attributes']['properties'].keys new(type, properties) end |
Instance Method Details
#alias ⇒ Object
55 56 57 |
# File 'lib/app_store_dev_api/request/builder/create.rb', line 55 def alias "create_#{@type.underscore.singularize}" end |
#http_method ⇒ Object
63 64 65 |
# File 'lib/app_store_dev_api/request/builder/create.rb', line 63 def http_method 'post' end |
#source ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/app_store_dev_api/request/builder/create.rb', line 43 def source @source ||= begin require 'erb' erb = ERB.new(TEMPLATE, trim_mode: '%<>-') erb.result(binding) end @source end |
#url ⇒ Object
59 60 61 |
# File 'lib/app_store_dev_api/request/builder/create.rb', line 59 def url "https://api.appstoreconnect.apple.com/#{@version}/#{@type}" end |